
<template>
<div>
   <ul class="mui-table-view">
        <li class="mui-table-view-cell mui-media" v-for="item in newsList" :key="item.id">
            <router-link :to="'/home/newsInfo/'+item.id">
                <img class="mui-media-object mui-pull-left" :src="item.img_url">
                <div class="mui-media-body">
                    <h3>{{ item.title }}</h3>
                    <p class='mui-ellipsis'>
                        <span>发表时间：{{ item.add_time }}</span>
                        <span>点击次数：{{ item.click }}</span>
                    </p>
                </div>
            </router-link>
        </li>
    </ul>
</div>
</template>    
<script>
import {Toast} from "mint-ui"
export default{
    data(){
        return {
            newsList:[//新闻列表
                {"add_time":new Date().toLocaleString(),click:1,id:13,title:"嘤嘤嘤",img_url:""},
                {"add_time":new Date().toLocaleString(),click:2,id:14,title:"嘤你个大头鬼",img_url:""},
                {"add_time":new Date().toLocaleString(),click:3,id:15,title:"嘤嘤嘤",img_url:""},
                {"add_time":new Date().toLocaleString(),click:3,id:16,title:"嘤嘤嘤",img_url:""},
                {"add_time":new Date().toLocaleString(),click:3,id:17,title:"嘤嘤嘤",img_url:""},
                {"add_time":new Date().toLocaleString(),click:3,id:18,title:"嘤嘤嘤",img_url:""},
                {"add_time":new Date().toLocaleString(),click:3,id:19,title:"嘤嘤嘤",img_url:""},
                {"add_time":new Date().toLocaleString(),click:3,id:20,title:"嘤嘤嘤",img_url:""},
                {"add_time":new Date().toLocaleString(),click:3,id:21,title:"嘤嘤嘤",img_url:""},
                {"add_time":new Date().toLocaleString(),click:3,id:22,title:"嘤嘤嘤",img_url:""},
                {"add_time":new Date().toLocaleString(),click:3,id:23,title:"嘤嘤嘤",img_url:""},
                {"add_time":new Date().toLocaleString(),click:3,id:24,title:"嘤嘤嘤",img_url:""},
                {"add_time":new Date().toLocaleString(),click:3,id:25,title:"嘤嘤嘤",img_url:""},
                {"add_time":new Date().toLocaleString(),click:3,id:26,title:"嘤嘤嘤",img_url:""},
            ]
        }
    },
    created(){
        // 获取新闻  图文信息
        // this.getNewsList();
    },
    methods:{
        getNewsList(){
            //获取新闻列表
            this.$http.get(url).then(result =>{
                if (result.body.status === 0 ) {
                    this.newsList = result.body.message;    
                }else{
                    Toast("新闻获取失败");
                }
            })
        }
    }
}
</script>
<style lang="less" scoped>
    .mui-table-view{
        li{
            h3{
                font-size: 14px;
            }
            .mui-ellipsis{
                font-size: 12px;
                color: #226af5;
                display: flex;
                justify-content: space-between;
            }
        }
    }
</style> 